# **********************************************************************
#
# Copyright (c) 2003-2009 ZeroC, Inc. All rights reserved.
#
# This copy of Ice is licensed to you under the terms described in the
# ICE_LICENSE file included in this distribution.
#
# **********************************************************************

# Ice version 3.3.1
# Generated from file `SerialIO.ice'

import Ice, IcePy, __builtin__

if not Ice.__dict__.has_key("_struct_marker"):
    Ice._struct_marker = object()
import TeRKCommon_ice

# Included module Ice
_M_Ice = Ice.openModule('Ice')

# Included module Glacier2
_M_Glacier2 = Ice.openModule('Glacier2')

# Included module peer
_M_peer = Ice.openModule('peer')

# Included module TeRK
_M_TeRK = Ice.openModule('TeRK')

# Start of module TeRK
__name__ = 'TeRK'

if not _M_TeRK.__dict__.has_key('SerialIOBaudRate'):
    _M_TeRK.SerialIOBaudRate = Ice.createTempClass()
    class SerialIOBaudRate(object):

        def __init__(self, val):
            assert(val >= 0 and val < 16)
            self.value = val

        def __str__(self):
            if self.value == 0:
                return 'BAUD50'
            elif self.value == 1:
                return 'BAUD75'
            elif self.value == 2:
                return 'BAUD110'
            elif self.value == 3:
                return 'BAUD150'
            elif self.value == 4:
                return 'BAUD200'
            elif self.value == 5:
                return 'BAUD300'
            elif self.value == 6:
                return 'BAUD600'
            elif self.value == 7:
                return 'BAUD1200'
            elif self.value == 8:
                return 'BAUD1800'
            elif self.value == 9:
                return 'BAUD2400'
            elif self.value == 10:
                return 'BAUD4800'
            elif self.value == 11:
                return 'BAUD9600'
            elif self.value == 12:
                return 'BAUD19200'
            elif self.value == 13:
                return 'BAUD38400'
            elif self.value == 14:
                return 'BAUD57600'
            elif self.value == 15:
                return 'BAUD115200'
            return None

        __repr__ = __str__

        def __hash__(self):
            return self.value

        def __cmp__(self, other):
            return cmp(self.value, other.value)

    SerialIOBaudRate.BAUD50 = SerialIOBaudRate(0)
    SerialIOBaudRate.BAUD75 = SerialIOBaudRate(1)
    SerialIOBaudRate.BAUD110 = SerialIOBaudRate(2)
    SerialIOBaudRate.BAUD150 = SerialIOBaudRate(3)
    SerialIOBaudRate.BAUD200 = SerialIOBaudRate(4)
    SerialIOBaudRate.BAUD300 = SerialIOBaudRate(5)
    SerialIOBaudRate.BAUD600 = SerialIOBaudRate(6)
    SerialIOBaudRate.BAUD1200 = SerialIOBaudRate(7)
    SerialIOBaudRate.BAUD1800 = SerialIOBaudRate(8)
    SerialIOBaudRate.BAUD2400 = SerialIOBaudRate(9)
    SerialIOBaudRate.BAUD4800 = SerialIOBaudRate(10)
    SerialIOBaudRate.BAUD9600 = SerialIOBaudRate(11)
    SerialIOBaudRate.BAUD19200 = SerialIOBaudRate(12)
    SerialIOBaudRate.BAUD38400 = SerialIOBaudRate(13)
    SerialIOBaudRate.BAUD57600 = SerialIOBaudRate(14)
    SerialIOBaudRate.BAUD115200 = SerialIOBaudRate(15)

    _M_TeRK._t_SerialIOBaudRate = IcePy.defineEnum('::TeRK::SerialIOBaudRate', SerialIOBaudRate, (), (SerialIOBaudRate.BAUD50, SerialIOBaudRate.BAUD75, SerialIOBaudRate.BAUD110, SerialIOBaudRate.BAUD150, SerialIOBaudRate.BAUD200, SerialIOBaudRate.BAUD300, SerialIOBaudRate.BAUD600, SerialIOBaudRate.BAUD1200, SerialIOBaudRate.BAUD1800, SerialIOBaudRate.BAUD2400, SerialIOBaudRate.BAUD4800, SerialIOBaudRate.BAUD9600, SerialIOBaudRate.BAUD19200, SerialIOBaudRate.BAUD38400, SerialIOBaudRate.BAUD57600, SerialIOBaudRate.BAUD115200))

    _M_TeRK.SerialIOBaudRate = SerialIOBaudRate
    del SerialIOBaudRate

if not _M_TeRK.__dict__.has_key('SerialIOCharacterSize'):
    _M_TeRK.SerialIOCharacterSize = Ice.createTempClass()
    class SerialIOCharacterSize(object):

        def __init__(self, val):
            assert(val >= 0 and val < 4)
            self.value = val

        def __str__(self):
            if self.value == 0:
                return 'CHARSIZE5'
            elif self.value == 1:
                return 'CHARSIZE6'
            elif self.value == 2:
                return 'CHARSIZE7'
            elif self.value == 3:
                return 'CHARSIZE8'
            return None

        __repr__ = __str__

        def __hash__(self):
            return self.value

        def __cmp__(self, other):
            return cmp(self.value, other.value)

    SerialIOCharacterSize.CHARSIZE5 = SerialIOCharacterSize(0)
    SerialIOCharacterSize.CHARSIZE6 = SerialIOCharacterSize(1)
    SerialIOCharacterSize.CHARSIZE7 = SerialIOCharacterSize(2)
    SerialIOCharacterSize.CHARSIZE8 = SerialIOCharacterSize(3)

    _M_TeRK._t_SerialIOCharacterSize = IcePy.defineEnum('::TeRK::SerialIOCharacterSize', SerialIOCharacterSize, (), (SerialIOCharacterSize.CHARSIZE5, SerialIOCharacterSize.CHARSIZE6, SerialIOCharacterSize.CHARSIZE7, SerialIOCharacterSize.CHARSIZE8))

    _M_TeRK.SerialIOCharacterSize = SerialIOCharacterSize
    del SerialIOCharacterSize

if not _M_TeRK.__dict__.has_key('SerialIOParity'):
    _M_TeRK.SerialIOParity = Ice.createTempClass()
    class SerialIOParity(object):

        def __init__(self, val):
            assert(val >= 0 and val < 3)
            self.value = val

        def __str__(self):
            if self.value == 0:
                return 'PARITYEVEN'
            elif self.value == 1:
                return 'PARITYODD'
            elif self.value == 2:
                return 'PARITYNONE'
            return None

        __repr__ = __str__

        def __hash__(self):
            return self.value

        def __cmp__(self, other):
            return cmp(self.value, other.value)

    SerialIOParity.PARITYEVEN = SerialIOParity(0)
    SerialIOParity.PARITYODD = SerialIOParity(1)
    SerialIOParity.PARITYNONE = SerialIOParity(2)

    _M_TeRK._t_SerialIOParity = IcePy.defineEnum('::TeRK::SerialIOParity', SerialIOParity, (), (SerialIOParity.PARITYEVEN, SerialIOParity.PARITYODD, SerialIOParity.PARITYNONE))

    _M_TeRK.SerialIOParity = SerialIOParity
    del SerialIOParity

if not _M_TeRK.__dict__.has_key('SerialIOStopBits'):
    _M_TeRK.SerialIOStopBits = Ice.createTempClass()
    class SerialIOStopBits(object):

        def __init__(self, val):
            assert(val >= 0 and val < 2)
            self.value = val

        def __str__(self):
            if self.value == 0:
                return 'STOPBITS1'
            elif self.value == 1:
                return 'STOPBITS2'
            return None

        __repr__ = __str__

        def __hash__(self):
            return self.value

        def __cmp__(self, other):
            return cmp(self.value, other.value)

    SerialIOStopBits.STOPBITS1 = SerialIOStopBits(0)
    SerialIOStopBits.STOPBITS2 = SerialIOStopBits(1)

    _M_TeRK._t_SerialIOStopBits = IcePy.defineEnum('::TeRK::SerialIOStopBits', SerialIOStopBits, (), (SerialIOStopBits.STOPBITS1, SerialIOStopBits.STOPBITS2))

    _M_TeRK.SerialIOStopBits = SerialIOStopBits
    del SerialIOStopBits

if not _M_TeRK.__dict__.has_key('SerialIOFlowControl'):
    _M_TeRK.SerialIOFlowControl = Ice.createTempClass()
    class SerialIOFlowControl(object):

        def __init__(self, val):
            assert(val >= 0 and val < 3)
            self.value = val

        def __str__(self):
            if self.value == 0:
                return 'FLOWCONTROLHARDWARE'
            elif self.value == 1:
                return 'FLOWCONTROLSOFTWARE'
            elif self.value == 2:
                return 'FLOWCONTROLNONE'
            return None

        __repr__ = __str__

        def __hash__(self):
            return self.value

        def __cmp__(self, other):
            return cmp(self.value, other.value)

    SerialIOFlowControl.FLOWCONTROLHARDWARE = SerialIOFlowControl(0)
    SerialIOFlowControl.FLOWCONTROLSOFTWARE = SerialIOFlowControl(1)
    SerialIOFlowControl.FLOWCONTROLNONE = SerialIOFlowControl(2)

    _M_TeRK._t_SerialIOFlowControl = IcePy.defineEnum('::TeRK::SerialIOFlowControl', SerialIOFlowControl, (), (SerialIOFlowControl.FLOWCONTROLHARDWARE, SerialIOFlowControl.FLOWCONTROLSOFTWARE, SerialIOFlowControl.FLOWCONTROLNONE))

    _M_TeRK.SerialIOFlowControl = SerialIOFlowControl
    del SerialIOFlowControl

if not _M_TeRK.__dict__.has_key('SerialIOConfig'):
    _M_TeRK.SerialIOConfig = Ice.createTempClass()
    class SerialIOConfig(object):
        def __init__(self, portName='', baud=_M_TeRK.SerialIOBaudRate.BAUD50, characterSize=_M_TeRK.SerialIOCharacterSize.CHARSIZE5, parity=_M_TeRK.SerialIOParity.PARITYEVEN, stopBits=_M_TeRK.SerialIOStopBits.STOPBITS1, flowControl=_M_TeRK.SerialIOFlowControl.FLOWCONTROLHARDWARE):
            self.portName = portName
            self.baud = baud
            self.characterSize = characterSize
            self.parity = parity
            self.stopBits = stopBits
            self.flowControl = flowControl

        def __hash__(self):
            _h = 0
            _h = 5 * _h + __builtin__.hash(self.portName)
            _h = 5 * _h + __builtin__.hash(self.baud)
            _h = 5 * _h + __builtin__.hash(self.characterSize)
            _h = 5 * _h + __builtin__.hash(self.parity)
            _h = 5 * _h + __builtin__.hash(self.stopBits)
            _h = 5 * _h + __builtin__.hash(self.flowControl)
            return _h % 0x7fffffff

        def __cmp__(self, other):
            if other == None:
                return 1
            if self.portName < other.portName:
                return -1
            elif self.portName > other.portName:
                return 1
            if self.baud < other.baud:
                return -1
            elif self.baud > other.baud:
                return 1
            if self.characterSize < other.characterSize:
                return -1
            elif self.characterSize > other.characterSize:
                return 1
            if self.parity < other.parity:
                return -1
            elif self.parity > other.parity:
                return 1
            if self.stopBits < other.stopBits:
                return -1
            elif self.stopBits > other.stopBits:
                return 1
            if self.flowControl < other.flowControl:
                return -1
            elif self.flowControl > other.flowControl:
                return 1
            return 0

        def __str__(self):
            return IcePy.stringify(self, _M_TeRK._t_SerialIOConfig)

        __repr__ = __str__

    _M_TeRK._t_SerialIOConfig = IcePy.defineStruct('::TeRK::SerialIOConfig', SerialIOConfig, (), (
        ('portName', (), IcePy._t_string),
        ('baud', (), _M_TeRK._t_SerialIOBaudRate),
        ('characterSize', (), _M_TeRK._t_SerialIOCharacterSize),
        ('parity', (), _M_TeRK._t_SerialIOParity),
        ('stopBits', (), _M_TeRK._t_SerialIOStopBits),
        ('flowControl', (), _M_TeRK._t_SerialIOFlowControl)
    ))

    _M_TeRK.SerialIOConfig = SerialIOConfig
    del SerialIOConfig

if not _M_TeRK.__dict__.has_key('SerialIOException'):
    _M_TeRK.SerialIOException = Ice.createTempClass()
    class SerialIOException(_M_TeRK.TeRKException):
        def __init__(self, reason=''):
            _M_TeRK.TeRKException.__init__(self, reason)

        def ice_name(self):
            return 'TeRK::SerialIOException'

        def __str__(self):
            return IcePy.stringifyException(self)

        __repr__ = __str__

    _M_TeRK._t_SerialIOException = IcePy.defineException('::TeRK::SerialIOException', SerialIOException, (), _M_TeRK._t_TeRKException, ())
    SerialIOException.ice_type = _M_TeRK._t_SerialIOException

    _M_TeRK.SerialIOException = SerialIOException
    del SerialIOException

if not _M_TeRK.__dict__.has_key('SerialIOService'):
    _M_TeRK.SerialIOService = Ice.createTempClass()
    class SerialIOService(_M_TeRK.AbstractCommandController):
        def __init__(self):
            if __builtin__.type(self) == _M_TeRK.SerialIOService:
                raise RuntimeError('TeRK.SerialIOService is an abstract class')

        def ice_ids(self, current=None):
            return ('::Ice::Object', '::TeRK::AbstractCommandController', '::TeRK::PropertyManager', '::TeRK::SerialIOService')

        def ice_id(self, current=None):
            return '::TeRK::SerialIOService'

        def ice_staticId():
            return '::TeRK::SerialIOService'
        ice_staticId = staticmethod(ice_staticId)

        #
        # Operation signatures.
        #
        # def open(self, config, current=None):
        # def isOpen(self, portName, current=None):
        # def isDataAvailable(self, portName, current=None):
        # def read(self, portName, maxNumberOfBytesToRead, current=None):
        # def blockingRead(self, portName, maxNumberOfBytesToRead, timeoutMilliseconds, current=None):
        # def readUntilDelimiter(self, portName, maxNumberOfBytesToRead, delimiterCharacter, current=None):
        # def blockingReadUntilDelimiter(self, portName, maxNumberOfBytesToRead, delimiterCharacter, timeoutMilliseconds, current=None):
        # def write(self, portName, data, current=None):
        # def close(self, portName, current=None):

        def __str__(self):
            return IcePy.stringify(self, _M_TeRK._t_SerialIOService)

        __repr__ = __str__

    _M_TeRK.SerialIOServicePrx = Ice.createTempClass()
    class SerialIOServicePrx(_M_TeRK.AbstractCommandControllerPrx):

        def open(self, config, _ctx=None):
            return _M_TeRK.SerialIOService._op_open.invoke(self, ((config, ), _ctx))

        def open_async(self, _cb, config, _ctx=None):
            return _M_TeRK.SerialIOService._op_open.invokeAsync(self, (_cb, (config, ), _ctx))

        def isOpen(self, portName, _ctx=None):
            return _M_TeRK.SerialIOService._op_isOpen.invoke(self, ((portName, ), _ctx))

        def isOpen_async(self, _cb, portName, _ctx=None):
            return _M_TeRK.SerialIOService._op_isOpen.invokeAsync(self, (_cb, (portName, ), _ctx))

        def isDataAvailable(self, portName, _ctx=None):
            return _M_TeRK.SerialIOService._op_isDataAvailable.invoke(self, ((portName, ), _ctx))

        def isDataAvailable_async(self, _cb, portName, _ctx=None):
            return _M_TeRK.SerialIOService._op_isDataAvailable.invokeAsync(self, (_cb, (portName, ), _ctx))

        def read(self, portName, maxNumberOfBytesToRead, _ctx=None):
            return _M_TeRK.SerialIOService._op_read.invoke(self, ((portName, maxNumberOfBytesToRead), _ctx))

        def read_async(self, _cb, portName, maxNumberOfBytesToRead, _ctx=None):
            return _M_TeRK.SerialIOService._op_read.invokeAsync(self, (_cb, (portName, maxNumberOfBytesToRead), _ctx))

        def blockingRead(self, portName, maxNumberOfBytesToRead, timeoutMilliseconds, _ctx=None):
            return _M_TeRK.SerialIOService._op_blockingRead.invoke(self, ((portName, maxNumberOfBytesToRead, timeoutMilliseconds), _ctx))

        def blockingRead_async(self, _cb, portName, maxNumberOfBytesToRead, timeoutMilliseconds, _ctx=None):
            return _M_TeRK.SerialIOService._op_blockingRead.invokeAsync(self, (_cb, (portName, maxNumberOfBytesToRead, timeoutMilliseconds), _ctx))

        def readUntilDelimiter(self, portName, maxNumberOfBytesToRead, delimiterCharacter, _ctx=None):
            return _M_TeRK.SerialIOService._op_readUntilDelimiter.invoke(self, ((portName, maxNumberOfBytesToRead, delimiterCharacter), _ctx))

        def readUntilDelimiter_async(self, _cb, portName, maxNumberOfBytesToRead, delimiterCharacter, _ctx=None):
            return _M_TeRK.SerialIOService._op_readUntilDelimiter.invokeAsync(self, (_cb, (portName, maxNumberOfBytesToRead, delimiterCharacter), _ctx))

        def blockingReadUntilDelimiter(self, portName, maxNumberOfBytesToRead, delimiterCharacter, timeoutMilliseconds, _ctx=None):
            return _M_TeRK.SerialIOService._op_blockingReadUntilDelimiter.invoke(self, ((portName, maxNumberOfBytesToRead, delimiterCharacter, timeoutMilliseconds), _ctx))

        def blockingReadUntilDelimiter_async(self, _cb, portName, maxNumberOfBytesToRead, delimiterCharacter, timeoutMilliseconds, _ctx=None):
            return _M_TeRK.SerialIOService._op_blockingReadUntilDelimiter.invokeAsync(self, (_cb, (portName, maxNumberOfBytesToRead, delimiterCharacter, timeoutMilliseconds), _ctx))

        def write(self, portName, data, _ctx=None):
            return _M_TeRK.SerialIOService._op_write.invoke(self, ((portName, data), _ctx))

        def write_async(self, _cb, portName, data, _ctx=None):
            return _M_TeRK.SerialIOService._op_write.invokeAsync(self, (_cb, (portName, data), _ctx))

        def close(self, portName, _ctx=None):
            return _M_TeRK.SerialIOService._op_close.invoke(self, ((portName, ), _ctx))

        def close_async(self, _cb, portName, _ctx=None):
            return _M_TeRK.SerialIOService._op_close.invokeAsync(self, (_cb, (portName, ), _ctx))

        def checkedCast(proxy, facetOrCtx=None, _ctx=None):
            return _M_TeRK.SerialIOServicePrx.ice_checkedCast(proxy, '::TeRK::SerialIOService', facetOrCtx, _ctx)
        checkedCast = staticmethod(checkedCast)

        def uncheckedCast(proxy, facet=None):
            return _M_TeRK.SerialIOServicePrx.ice_uncheckedCast(proxy, facet)
        uncheckedCast = staticmethod(uncheckedCast)

    _M_TeRK._t_SerialIOServicePrx = IcePy.defineProxy('::TeRK::SerialIOService', SerialIOServicePrx)

    _M_TeRK._t_SerialIOService = IcePy.defineClass('::TeRK::SerialIOService', SerialIOService, (), True, None, (_M_TeRK._t_AbstractCommandController,), ())
    SerialIOService.ice_type = _M_TeRK._t_SerialIOService

    SerialIOService._op_open = IcePy.Operation('open', Ice.OperationMode.Normal, Ice.OperationMode.Normal, False, (), (((), _M_TeRK._t_SerialIOConfig),), (), None, (_M_TeRK._t_SerialIOException,))
    SerialIOService._op_isOpen = IcePy.Operation('isOpen', Ice.OperationMode.Normal, Ice.OperationMode.Normal, False, (), (((), IcePy._t_string),), (), IcePy._t_bool, ())
    SerialIOService._op_isDataAvailable = IcePy.Operation('isDataAvailable', Ice.OperationMode.Normal, Ice.OperationMode.Normal, False, (), (((), IcePy._t_string),), (), IcePy._t_bool, (_M_TeRK._t_SerialIOException,))
    SerialIOService._op_read = IcePy.Operation('read', Ice.OperationMode.Normal, Ice.OperationMode.Normal, False, (), (((), IcePy._t_string), ((), IcePy._t_int)), (), _M_TeRK._t_ByteArray, (_M_TeRK._t_SerialIOException,))
    SerialIOService._op_blockingRead = IcePy.Operation('blockingRead', Ice.OperationMode.Normal, Ice.OperationMode.Normal, False, (), (((), IcePy._t_string), ((), IcePy._t_int), ((), IcePy._t_int)), (), _M_TeRK._t_ByteArray, (_M_TeRK._t_SerialIOException,))
    SerialIOService._op_readUntilDelimiter = IcePy.Operation('readUntilDelimiter', Ice.OperationMode.Normal, Ice.OperationMode.Normal, False, (), (((), IcePy._t_string), ((), IcePy._t_int), ((), IcePy._t_byte)), (), _M_TeRK._t_ByteArray, (_M_TeRK._t_SerialIOException,))
    SerialIOService._op_blockingReadUntilDelimiter = IcePy.Operation('blockingReadUntilDelimiter', Ice.OperationMode.Normal, Ice.OperationMode.Normal, False, (), (((), IcePy._t_string), ((), IcePy._t_int), ((), IcePy._t_byte), ((), IcePy._t_int)), (), _M_TeRK._t_ByteArray, (_M_TeRK._t_SerialIOException,))
    SerialIOService._op_write = IcePy.Operation('write', Ice.OperationMode.Normal, Ice.OperationMode.Normal, False, (), (((), IcePy._t_string), ((), _M_TeRK._t_ByteArray)), (), None, (_M_TeRK._t_SerialIOException,))
    SerialIOService._op_close = IcePy.Operation('close', Ice.OperationMode.Normal, Ice.OperationMode.Normal, False, (), (((), IcePy._t_string),), (), None, ())

    _M_TeRK.SerialIOService = SerialIOService
    del SerialIOService

    _M_TeRK.SerialIOServicePrx = SerialIOServicePrx
    del SerialIOServicePrx

# End of module TeRK
